//
//  SSUnserviceLineCell.swift
//  拾舍清洁
//
//  Created by sky.wei on 2023/6/30.
//

import UIKit

class SSUnserviceLineCell: UICollectionViewCell {
    
    @IBOutlet weak var weekLab: UILabel!
    
    @IBOutlet weak var dateLab: UILabel!
    @IBOutlet weak var redView: UIView!
    
    @IBOutlet weak var bgView: UIView!
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }
    
    var model = SSEmployeeOrder() {
        didSet {
            weekLab.text = model.weekDay
            dateLab.text = model.date
            redView.isHidden = !(model.taskCount > 0)
            if(model.isSelected){
                weekLab.textColor = UIColor(hex: "#2475FF")
                dateLab.textColor = UIColor(hex: "#2475FF")
                bgView.layer.borderWidth = 1
                bgView.layer.borderColor = UIColor(hex: "#2475FF")?.cgColor
            }else{
                weekLab.textColor = UIColor.black
                dateLab.textColor = UIColor.black
                bgView.layer.borderWidth = 0
                bgView.layer.borderColor = UIColor.clear.cgColor
            }
            
            let strs = model.date.components(separatedBy: "-")
            print("")
            if(strs.count < 3){return}
            dateLab.text = "\(strs[1])/" + "\(strs[2])"
            
            

        }
    }

}
